{% extends 'base.html' %}

{% block title %}
    惠房网-{{ city }}房源-{{ city }}在售二手房  租房|新房|二手房——优质房源
{% endblock %}

{% block styles %}
    {{ super() }}
    <!-- 引入在售二手房列表页样式文件sellhouse.css -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/ershoufang/sellhouse.css') }}">
{% endblock %}

{% block content %}

    {% block newcontent %}
        <!-- header头部信息 -->
        <header class="headers">
            <div class="w">
                <div class="title">
                    <a href="{{ url_for('house_bp.ershoufang',city=city) }}" class="logo" title="{{ city }}在售二手房">
                        <img src="{{ url_for('static',filename='images/hz_logo.png') }}" alt="">
                        <span>惠房二手房</span>
                    </a>
                    <ul class="typelist">
                        <li><a href="{{ url_for('house_bp.ershoufang',city=city) }}">在售</a></li>
                        <li><a href="{{ url_for('house_bp.dealershouhouse',city=city) }}">成交</a></li>
                        <li><a href="javascript:;">小区</a></li>
                        <li><a href="javascript:;">房源指数</a></li>
                        <li><a href="javascript:;">下载APP</a></li>
                    </ul>
                </div>
            </div>
        </header>
        <!-- 筛选区域 -->
        <div class="filter w">
            <!-- 城市区域 -->
            <div class="position">
                <div class="post-hd">
                    <span class="wz">位置</span>
                    <div class="area">
                        <a href="javascript:;">
                            区域
                            <span class="arrow1"></span>
                        </a>
                        <a href="javascript:;">
                            地铁线
                            <span class="arrow2"></span>
                        </a>
                    </div>
                </div>
                <div class="post-bd">
                    <ul class="arealist">
                        {% for area in areas %}
                            <li><a href="javascript:;">{{ area.area_name }}</a></li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
        <!-- 内容区域 -->
        <div class="content w">
            <!-- 左边区域 -->
            <div class="leftcontent">
                <div class="orderFilter">
                    <div class="orderTaa">
                        <ul>
                            <li class="selectoe">
                                <a href="{{ url_for('house_bp.ershoufang',city=city) }}">
                                    <h2>默认排序</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>最新发布</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>总价</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>房屋单价</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>面积</h2>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="texttitle">
                    <div class="resultDes">
                        <div class="total">
                            共找到
                            <span> {{ sell_num }} </span>
                            套
                            <a href="javascript:;">{{ city }}二手房</a>
                        </div>
                    </div>
                </div>
                <div class="datalist">
                    <ul class="datas">
                        {% for sell in data_list.items %}
                        <li class="data">
                            <a href="{{ url_for('house_bp.ershoufang',city=city) }}?sellid={{ sell.sell_id }}" class="dataimg">
                                <img src="{{ sell.house_img }}" alt="">
                            </a>
                            <div class="info">
                                <div class="title">
                                    <a href="{{ url_for('house_bp.ershoufang',city=city) }}?sellid={{ sell.sell_id }}" class="dataview" title="{{ sell.title }}">
                                        {{ sell.title }}
                                    </a>
                                </div>
                                <div class="address">
                                    <div class="flood">
                                        <span></span>
                                        <div class="community">
                                            {{ sell.area_name }} | {{ sell.shop_name }} | {{ sell.community }}
                                        </div>
                                    </div>
                                    <div class="houseInfo">
                                        <span></span>
                                        {% if sell.house_type %}
                                            {{ sell.floor }} · {{ sell.house_type[:4] }} · {{ sell.bullde_area }}平米 · {{ sell.house_face }}
                                        {% else %}
                                            {{ sell.floor }} · {{ sell.bullde_area }}平米 · {{ sell.house_face }}
                                        {% endif %}
                                    </div>
                                    <div class="followInfo">
                                        <span></span>
                                        {{ sell.ownership }} / {{ sell.house_use }} / {{ sell.property_belo }}
                                    </div>
                                </div>
                                <div class="priceInfo">
                                    <div class="totalPrice">
                                        <span>{{ sell.total_price }}</span>
                                        万
                                    </div>
                                    <div class="unitPrice">
                                        <span>单价{{ sell.unit_price }}元/平米</span>
                                    </div>
                                </div>
                            </div>
                        </li>
                        {% endfor %}
                    </ul>
                </div>

                <!-- 翻页 -->
                <div class="next-page">
                    <div class="page-left">
                        <span>惠房网 &nbsp;>&nbsp; </span>
                        <span>{{ city }}房产 &nbsp;>&nbsp; </span>
                        <span>{{ city }}在售二手房</span>
                    </div>
                    <div class="page-right">
                        <ul>
                            {% if data_list.has_prev %}
                                <li {% if not data_list.has_prev %} class="disabled" {% else %} class="nexts" {% endif %}>
                                    <a href="{{ url_for('house_bp.ershoufang',city=city) }}?page={{ data_list.prev_num }}">上一页</a>
                                </li>
                            {% endif %}
                            
                            {% if data_list.pages > 5 %}
                                {% if data_list.page < 5 %}
                                    {% for page_num in range(1,6) %}
                                        <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                            <a href="{{ url_for('house_bp.ershoufang',city=city) }}?page={{ page_num }}">{{ page_num }}
                                            </a>
                                        </li>
                                    {% endfor %}
                                {% else %}
                                    {% if data_list.next_num %}
                                        {% for page_num in range(data_list.next_num - 4,data_list.next_num + 1) %}
                                            <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                                <a href="{{ url_for('house_bp.ershoufang',city=city) }}?page={{ page_num }}">{{ page_num }}
                                                </a>
                                            </li>
                                        {% endfor %}
                                    {% else %}
                                        {% for page_num in range(data_list.pages - 4,data_list.pages + 1) %}
                                            <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                                <a href="{{ url_for('house_bp.ershoufang',city=city) }}?page={{ page_num }}">{{ page_num }}
                                                </a>
                                            </li>
                                        {% endfor %}
                                    {% endif %}

                                {% endif %}
                            {% else %}
                                <!-- 如果总页数小于5执行 -->
                                {% for page_num in range(1,data_list.pages + 1) %}
                                    <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                        <a href="{{ url_for('house_bp.ershoufang',city=city) }}?page={{ page_num }}">{{ page_num }}
                                        </a>
                                    </li>
                                {% endfor %}
                            {% endif %}
                            
                            {% if data_list.has_next %}
                                <li {% if not data_list.has_next %} class="disabled" {% else %} class="nexts"{% endif %}>
                                    <a href="{{ url_for('house_bp.ershoufang',city=city) }}?page={{ data_list.next_num }}">下一页</a>
                                </li>
                            {% endif %}
                        </ul>
                    </div>
                </div>
            </div>
            <!-- 右边广告区域 -->
            <div class="rightcontent">
                <div class="recommend-first">
                    <p class="head">热门招聘</p>
                    <div class="recommend-item">
                        <a href="http://120.79.190.101/user/">
                            <img src="{{ url_for('static',filename='images/job.jpg') }}" alt="惠职招聘">
                            <p class="sysment">惠职招聘 职位来袭 一起寻找心目中的offer</p>
                            <p class="select">全国热门城市等您挑选~~~</p>
                            <p class="desc">绩效奖金 | 带薪年假...</p>
                        </a>
                    </div>
                </div>
                <div class="recommend-last">
                    <p class="head">火爆影集</p>
                    <div class="recommend-item">
                        <a href="http://112.74.83.39/movie/">
                            <img src="{{ url_for('static',filename='images/login.jpg') }}" alt="惠职招聘">
                            <p class="sysment">惠职影视 邀您共享 科技|灾难|动作|悬疑大片精彩不断</p>
                            <p class="select">精彩震撼大片火爆来袭~~~</p>
                            <p class="desc">历史|英雄|抗日...</p>
                        </a>
                    </div>
                </div>
            </div>
        </div>

    {% endblock %}

{% endblock %}
